package com.tj.collection.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.common.utils.CollectionUtils;
import com.google.common.collect.Lists;
import com.tj.collection.db.dao.RptUserOnlineDetailDao;
import com.tj.collection.db.entity.RptUserOnlineDetailEntity;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* User: linqu
* Date: 2023-11-27
* Time: 19:49:26.287
*/

@Repository
public class RptUserOnlineDetailDaoImpl extends AbstractBaseMapper<RptUserOnlineDetailEntity> implements RptUserOnlineDetailDao {

    @Override
    public void addOrUpdate(RptUserOnlineDetailEntity detailRecord) {
        this.getSqlSession().insert(this.getStatement("addOrUpdate"), detailRecord);

    }

    @Override
    public void batchInsert(List<RptUserOnlineDetailEntity> list) {
        if (CollectionUtils.isEmpty(list)) {
            return;
        }
        this.getSqlSession().insert(this.getStatement("batchInsert"), list);

    }

    @Override
    public List<RptUserOnlineDetailEntity> listUserOnline() {
        final List<RptUserOnlineDetailEntity> userOnlinList = this.getSqlSession().selectList(this.getStatement("listUserOnline"));
        if (CollectionUtils.isEmpty(userOnlinList)) {
            return Lists.newArrayList();
        }
        return userOnlinList;

    }
}